home *** CD-ROM | disk | FTP | other *** search
GW-BASIC | 1997-01-28 | 4.9 KB | 165 lines |
- 10 'LINELOSS - Losses in Transmission Lines - 28 APR 94 rev. 27 SEP 96
- 20 IF EX$=""THEN EX$="EXIT"
- 30 IF PROG$=""THEN GO$=EX$ ELSE GO$=PROG$
- 40 COMMON EX$,PROG$
- 50 CLS:KEY OFF
- 60 COLOR 7,0,1
- 70 U1$="#,###.###"
- 80 UL$=STRING$(80,205)
- 90 E$=STRING$(80,32)
- 100 '
- 110 '.....start
- 120 CLS
- 130 COLOR 15,2
- 140 PRINT " TRANSMISSION LINE LOSSES";TAB(57);"by George Murphy VE3ERP ";
- 150 COLOR 1,0:PRINT STRING$(80,"<0xDF!>");
- 160 COLOR 7,0
- 170 GOSUB 1080 'preface
- 180 COLOR 0,7:LOCATE 25,22
- 190 PRINT " Press 1 to continue or 0 to EXIT.....";
- 200 COLOR 7,0
- 210 Z$=INKEY$:IF Z$=""THEN 210
- 220 IF Z$="0"THEN CLS:CHAIN GO$
- 230 IF Z$="1"THEN 250
- 240 GOTO 210
- 250 GOSUB 1520 'screen dump
- 260 VIEW PRINT 3 TO 24:CLS:VIEW PRINT:LOCATE 3
- 270 PRINT " Press number in < > to choose standard unit of measure:"
- 280 PRINT UL$;
- 290 PRINT " < 1 > Metric"
- 300 PRINT " < 2 > U.S.A./Imperial"
- 310 Z$=INKEY$
- 320 IF Z$="1"THEN UM=0.3048:UM$="m.":GOTO 350
- 330 IF Z$="2"THEN UM=1:UM$="ft.":GOTO 350
- 340 GOTO 310
- 350 '.....inputs
- 360 VIEW PRINT 3 TO 24:CLS:VIEW PRINT:LOCATE 3
- 370 PRINT " Press <ENTER> to by-pass any of the following inputs:"
- 380 PRINT " (If you by-pass an essential input you will be asked for it again)"
- 390 PRINT UL$;
- 400 IF LG THEN 440
- 410 PRINT " ENTER: Length of transmission line (";UM$;")......................";
- 420 IF UM$="m."THEN PRINT ".";
- 430 INPUT LG:LG=LG/UM:GOSUB 620
- 440 IF FQ THEN 470
- 450 INPUT " ENTER: Frequency (MHz)........................................";FQ
- 460 GOSUB 620
- 470 IF DB THEN 510
- 480 PRINT " ENTER: Attenuation of line (dB per 100 ";UM$;") when matched......";
- 490 IF UM$="m."THEN PRINT ".";
- 500 INPUT DB:DB=DB*UM:GOSUB 620
- 510 IF SL THEN 550
- 520 INPUT " ENTER: SWR at load (e.g. antenna).............................";SL
- 530 IF SL=1 THEN SL=1.00001
- 540 GOSUB 620
- 550 IF SI THEN 590
- 560 INPUT " ENTER: SWR at input (e.g.transmitter or transmatch)............";SI
- 570 IF SI=1 THEN SI=1.00001
- 580 GOSUB 620
- 590 VIEW PRINT 6 TO 24:CLS:VIEW PRINT:LOCATE 6
- 600 GOTO 360
- 610 '
- 620 '.....calculate
- 630 FOR Z=1 TO 3
- 640 IF LG=0 AND M<>0 THEN LG=M/0.3048
- 650 IF A=0 AND SI<>0 THEN A=(SI+1)/(SI-1)
- 660 IF B=0 AND DB*LG<>0 THEN LM=DB*LG/100:B=10^(LM/10)
- 670 IF C=0 AND SL<>0 THEN C=(SL-1)/(SL+1)
- 680 IF SL=0 AND A*B<>0 THEN SL=(A+B)/(A-B)
- 690 IF SI=0 AND B*C<>0 THEN SI=(B+C)/(B-C)
- 700 IF L1=0 AND B*C<>0 THEN L1=B^2-C^2:L2=B*(1-C^2)
- 710 IF L1*L2<>0 AND L2<=0 THEN 770
- 720 IF LT=0 AND L1*L2<>0 THEN LT=10*LOG(L1/L2)/LOG(10) 'base 10
- 730 IF SI*SL*LT*FQ THEN 850
- 740 NEXT Z
- 750 RETURN
- 760 '
- 770 '.....infinite SWR
- 780 BEEP:PRINT:COLOR 15,4
- 790 PRINT " Line loss is excessively high. SWR is infinite............"
- 800 PRINT " .............Press any key to start over.................."
- 810 COLOR 7,0
- 820 IF INKEY$=""THEN 820
- 830 CLS:RUN EX$
- 840 '
- 850 '.....print
- 860 VIEW PRINT 3 TO 24:CLS:VIEW PRINT:LOCATE 3
- 870 PRINT " Length of transmission line...................";
- 880 PRINT USING U1$;LG*UM;:PRINT " ";UM$
- 890 PRINT " Frequency.....................................";
- 900 PRINT USING "#####.###";FQ;:PRINT " MHz"
- 910 PRINT " Attenuation per 100 ";UM$;" of line when matched..";
- 920 IF UM$="m."THEN PRINT ".";
- 930 PRINT USING U1$;DB/UM;:PRINT " dB @";:PRINT FQ;"MHz"
- 940 PRINT " SWR at load (e.g. antenna)....................";
- 950 PRINT USING U1$;SL;:PRINT " : 1"
- 960 PRINT " SWR at input (e.g. transmitter / transmatch)..";
- 970 PRINT USING U1$;SI;:PRINT " : 1"
- 980 PRINT " Attenuation of line when matched..............";
- 990 PRINT USING U1$;LM;:PRINT " dB"
- 1000 PRINT " Additional loss due to SWR....................";
- 1010 PRINT USING U1$;LT-LM;:PRINT " dB"
- 1020 PRINT " Total loss in line............................";
- 1030 PRINT USING U1$;LT;:PRINT " dB"
- 1040 PRINT UL$;
- 1050 GOSUB 1520
- 1060 GOTO 110 'start
- 1070 '
- 1080 '.....text
- 1090 T=7 'tab
- 1100 PRINT TAB(T);
- 1110 PRINT "It is impossible to give a specific relationship between line loss"
- 1120 PRINT TAB(T);
- 1130 PRINT "and frequency that will apply to all types of lines. Losses are"
- 1140 PRINT TAB(T);
- 1150 PRINT "due to many factors, such as the characteristics of the dielectric,"
- 1160 PRINT TAB(T);
- 1170 PRINT "whether the dielectric is air or a manufactured material, and on"
- 1180 PRINT TAB(T);
- 1190 PRINT "the line's construction, tolerances, installation, age, and state"
- 1200 PRINT TAB(T);
- 1210 PRINT "of deterioration. Furthermore, the same lines from different"
- 1220 PRINT TAB(T);
- 1230 PRINT "suppliers often have substantially different loss characteristics."
- 1240 PRINT
- 1250 PRINT TAB(T);
- 1260 PRINT"To use this program it is necessary to enter the loss in dB per"
- 1270 PRINT TAB(T);
- 1280 PRINT"unit length at a specific frequency for the transmission line under"
- 1290 PRINT TAB(T);
- 1300 PRINT"consideration. For the reasons stated above this data cannot be"
- 1310 PRINT TAB(T);
- 1320 PRINT"calculated accurately. However, for purposes of this program "
- 1330 PRINT TAB(T);
- 1340 PRINT"approximate data will suffice. This data can be found in graph form"
- 1350 PRINT TAB(T);
- 1360 PRINT"in the ARRL HANDBOOK, the ARRL Antenna Book, or the ARRL Electronics"
- 1370 PRINT TAB(T);
- 1380 PRINT"Data Book."
- 1390 PRINT
- 1400 PRINT TAB(T);
- 1410 PRINT "HAMCALC's ";CHR$(34);"COAXIAL CABLE CHARACTERISTICS";CHR$(34);
- 1420 PRINT " program can also provide"
- 1430 PRINT TAB(T);
- 1440 PRINT "estimated dB losses at any frequency for coaxial cable transmission"
- 1450 PRINT TAB(T);
- 1460 PRINT "lines."
- 1470 PRINT
- 1480 PRINT TAB(T);
- 1490 PRINT "This program was developed from a concept by GNEWran Hosinsky, EA8YU."
- 1500 RETURN
- 1510 '
- 1520 'HARDCOPY
- 1530 GOSUB 1640:LOCATE 25,2:COLOR 14,6
- 1540 PRINT " Press 1 to print screen, 2 to print screen & ";
- 1550 PRINT "advance paper, or 3 to continue.";:COLOR 7,0
- 1560 Z$=INKEY$:IF Z$="3"THEN GOSUB 1640:RETURN
- 1570 IF Z$="1"OR Z$="2"THEN GOSUB 1640:GOTO 1590
- 1580 GOTO 1560
- 1590 FOR QX=1 TO 24:FOR QY=1 TO 80
- 1600 LPRINT CHR$(SCREEN(QX,QY));
- 1610 NEXT QY:NEXT QX
- 1620 IF Z$="2"THEN LPRINT CHR$(12)
- 1630 GOTO 1530
- 1640 LOCATE 25,1:PRINT STRING$(80,32);:RETURN
-